package it.koutifaris.travianmap.utils;

import static it.koutifaris.testforclassutils.IsTestForAssert.assertIsTestFor;
import junit.framework.Assert;
import android.test.AndroidTestCase;

public class UrlStringParserTest extends AndroidTestCase {

	private UrlStringParser parser;

	@Override
	protected void setUp() throws Exception {
		parser = new UrlStringParser();
	}

	public void testPkgAndName() {
		assertIsTestFor(UrlStringParser.class);
	}

	public void testRemoveProtocol() {
		String domain = "example.com";
		String urlString = "http://" + domain + "/index.html";
		String expected = domain + "/index.html";

		Assert.assertEquals(expected, parser.removeProtocolIfExist(urlString));
	}

	public void testRemovePath() {
		String domain = "example.com";
		String urlString = "http://" + domain + "/index.html";
		String expected = "http://" + domain;

		Assert.assertEquals(expected, parser.removePathIfExist(urlString));
	}

	public void testGetHost() {
		String domain = "example.com";
		String urlString = "http://" + domain + "/index.html";

		Assert.assertEquals(domain, parser.getHost(urlString));
	}

}
